package com.leisai.manager.pojo;

import java.util.*;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: jim
 * @Date: 2021/12/17/9:45
 * @Description:
 */
public class TreeNode {
    //树节点id
    private  Integer id ;

    //父节点id
    private  Integer pid ;

    //节点名称
    private  String name ;

    //值
    private Double value;

    //子节点
    private List<TreeNode> children;

    //拓展字段
    private Map<String ,Object> extendsMap;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getValue() {
        return value;
    }

    public void setValue(Double value) {
        this.value = value;
    }

    public List<TreeNode> getChildren() {
        if (children == null){
            children = new ArrayList<>();
        }
        return children;
    }

    public void setChildren(List<TreeNode> children) {
        this.children = children;
    }

    public Map<String, Object> getExtendsMap() {
        if (extendsMap == null){
            extendsMap = new HashMap<String ,Object>();
        }
        return extendsMap;
    }

    public void setExtendsMap(Map<String, Object> extendsMap) {
        this.extendsMap = extendsMap;
    }

    @Override
    public String toString() {
        return "TreeNode{" +
                "id=" + id +
                ", pid=" + pid +
                ", name='" + name + '\'' +
                ", value=" + value +
                ", children=" + children +
                ", extendsMap=" + extendsMap +
                '}';
    }
}
